<template>
	<view>
		<cu-custom bgColor="bg-white" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">酒库查询</block>
		</cu-custom>
		<view>
			<view class="whole-box">
				<view class="search-form text-center align-center justify-center" @tap="modalName = 'searchModal'">
					
					 <input type="text" placeholder="请输入搜索的门店" confirm-type="search" v-model="keyword" @confirm="search"></input>
				</view>
				<view class="gold-black-box">
					<view class="list">
						<scroll-view scroll-y :style="'height:'+scrollHeight+'px'" @scrolltolower="getMore">
							<block v-for="(item,index) in list" :key="index">
							<view class="my-data-box" @tap="geturlress(item.urlress)">
								<image class="my-data-box-bg" src="@/static/black_bg/stander-box.png" mode="aspectFill"></image>
								
								<view class="my-data-box-content">
									<view class="goods-thumb bg-gray">
										<image mode="aspectFit" :src="item.cover"></image>
									</view>
									<view class="left-box">
										<view class="title" >{{item.name}}</view>
										<view class="time">地址：{{item.address}}</view>
									</view>
									
								</view>
							</view>
							</block>
						</scroll-view>
					</view>
					
				</view>
			</view>
		</view>
	</view>	
</template>

<script>
	export default {
		data() {
			return {
				member: null,
				total: 0,
				CLOUDPATH: this.$config.cloudPath,
				theme: this.$config.THEME(),
				list: [],
				hasMore: true,
				loading: false,
				page: 1,
				focus: false,
				keyword:'',
				scrollHeight:800,
			}
		},
		onLoad(options) {
			if (this.$common.loginAuth(true)) {}
		},
		onShow() {
			if (this.$common.loginAuth(true)) {
				this.$common.getMember().then((member) => {
					this.member = member
					this.getList()
				})
			}
		},
		methods: {
			geturlress(href) {
				if (href) {
					if (href.slice(0, 4) == 'http') {
						// #ifdef APP-VUE
						plus.runtime.openURL(href, (r) => {

						})
						// #endif

						// #ifndef APP-VUE
							uni.navigateTo({
								url: '/pages/site/webview?weburl='+ href			
							})
						// window.location.href = href
						// #endif
					} else {
						uni.navigateTo({
							url: href
						})
					}
				}
			},
			search() {
				this.list = []
				this.hasMore = true
				this.loading = false
				this.page = 1
				this.getList()
			},
			getList() {
				if (this.hasMore && !this.loading) {
					this.loading = true
					this.$http
						.get('channel_store_index', {
							page: this.page,
							keyword:this.keyword,
						})
						.then((response) => {
							let list = this.list
							if (response.data.data.list.length > 0) {
								list = list.concat(response.data.data.list)
							} else {
								this.hasMore = false
							}
							this.total = response.data.data.total
							this.list = list
							this.page += 1
							console.log(this.list)
							this.loading = false
							uni.hideLoading()
						})
						.catch((response) => {
							uni.hideLoading()
						})

				}
			}
		},
		onReachBottom() {
			this.getList()
		}
	}
</script>

<style>
	.goods-thumb{
		margin-top: 40rpx;
		height: 200rpx;
		max-height: 200rpx;
	/* 	position: fixed; */
		/* object-fit: cover; */
	}
	.goods-thumb image{
		width: 220rpx;
		height: 190rpx;
		min-height: 190rpx;
	}
	.search {
		background-color: #FFFFFF;
	}
	.search-form{
		background-color: #f5f5f5;
		    line-height: 32px;
		    height: 32px;
		    font-size: 12px;
		    color: #333333;
		    flex: 1;
		    display: flex;
		    align-items: center;
		    margin: 0 15px;
	}
	.whole-box{
		background-image: url(@/static/red-new/new-back.png);
		min-height: calc(100vh - 45px - 24rpx);
		padding: 12px 0;
	}
	.gold-black-box{
		padding: 12px 0;
		margin: 0 10rpx;
		/* border: 2rpx solid #999999; */
		border-radius: 30rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	
	.gold-black-box .top-box{
		/* margin-top: 25rpx; */
		width: 690rpx;
		height: 276rpx;
		border: 2rpx solid #999999;
		border-radius: 30rpx;
		overflow: hidden;
		position: relative;
	}
	.top-box .top-box-bg{
		width: 100%;
		height: 100%;
	}
	.top-box .top-box-content{
		width: 690rpx;
		/* height: 276rpx; */
		position: absolute;
		left: 0;
		top: 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 30rpx;
		padding: 0 30rpx;
	}
	.top-box-content .note-price{
		flex: 1;
		height: 102rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
	.note-price .note{
		font-size: 36rpx;
		font-weight: bold;
		color: #E5D4B9;
	}
	.note-price .price{
		font-size: 38rpx;
		font-weight: bold;
		color: #FFFFFF;
	}
	.top-box-content .icon-gold-tixian{
		width: 92rpx;
		height: 106rpx;
		flex-shrink: 0;
		margin-left: 20rpx;
	}
</style>

<style>
	.gold-black-box .list{
		margin-top: 10px;
	}
	.list .my-data-box{
		margin-top: 20rpx;
		width: 690rpx;
		height: 260rpx;
		border: 2rpx solid #999999;
		border-radius: 30rpx;
		overflow: hidden;
		position: relative;
	}
	.list .my-data-box:first-child{
		margin-top: 0;
	}
	.my-data-box .my-data-box-bg{
		width: 100%;
		height: 100%;
	}
	
	.my-data-box .my-data-box-content{
		width: 690rpx;
		height: 260rpx;
		position: absolute;
		left: 0;
		top: 0;
		display: flex;
		justify-content: space-between;
		/* align-items: center; */
		padding: 0 40rpx;
	}

	.my-data-box-content .left-box{
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: space-between;
	}
	.left-box .title{
		width: 	440rpx;
		font-size: 34rpx;
		font-weight: bold;
		color: #E9CFA4;
		overflow: hidden;    
		text-overflow:ellipsis;    
		white-space: nowrap;
		margin-top: 40rpx;
		margin-left: 40rpx;
	}
	.left-box .time{
		margin-top: 12rpx;
		margin-left: 40rpx;
		font-size: 29rpx;
		color: #E9CFA4;
		width: 200px;
	}
	
</style>

<style>
</style>
